package app.k.com.jiecaoapp.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.android.volley.toolbox.Volley;
import com.http.RequestQueue;
import com.http.callback.RequestCallBack;
import com.http.method.StringRequest;
import com.thread.ThreadExecutor;
import com.umeng.socialize.bean.SHARE_MEDIA;
import com.umeng.socialize.bean.SocializeEntity;
import com.umeng.socialize.controller.listener.SocializeListeners;
import com.umeng.socialize.media.UMImage;
import com.umeng.socialize.utils.OauthHelper;
import com.ymeng.UmentUtils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.concurrent.atomic.AtomicInteger;

import app.k.com.jiecaoapp.R;

/**
 * Created by mac_wk on 15-1-7.
 */
public class MoreFragment extends BaseFragment {

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (rootView == null) {
            rootView = inflater.inflate(R.layout.more_layout, null);
            initViews();
        }
        ViewGroup parent = (ViewGroup) rootView.getParent();
        if (parent != null) {
            parent.removeView(rootView);
        }
        return rootView;
    }

    private void initViews() {
        findViewById(R.id.button2).setOnClickListener(baseClick);
        findViewById(R.id.button3).setOnClickListener(baseClick);
        findViewById(R.id.button4).setOnClickListener(baseClick);
    }
    @Override
    protected void onClickView(View view) {
        final String url = "http://www.baidu.com";
       switch (view.getId())
       {
           case R.id.button2:
               UmentUtils.configQQ(getActivity(),"1104154188","UoE2Bi7dTjvqniA4");
               UmentUtils.configQQZone(getActivity(),"1104154188","UoE2Bi7dTjvqniA4");
//               boolean flag =  OauthHelper. isAuthenticatedAndTokenNotExpired(getActivity(), SHARE_MEDIA.QQ);
//               Toast.makeText(getActivity(),flag+"",Toast.LENGTH_LONG).show();
                UmentUtils.open("asdasdasd","http://www.baidu.com",new UMImage(getActivity(),R.drawable.ic_action_about),getActivity(),new SocializeListeners.SnsPostListener() {
                   @Override
                   public void onStart() {
                       Log.d("start","start");
                   }

                   @Override
                   public void onComplete(SHARE_MEDIA share_media, int i, SocializeEntity socializeEntity) {
                        Log.d("status",i+"");
                        if (i==200)
                        {
                            UmentUtils.unRegisterListener(this);
                        }

                   }
               });
               break;
           case R.id.button3:

               break;
           case R.id.button4:



               break;

       }

    }
}
